# /* vim filetype=sh : */ # -*- sh -*-

if [ -z "$1" ]
then echo "needz: no arguments"
     exit
fi

if [ ! -f "$1" ]
then echo "needz: $f not a file"
     exit
fi

In=${In=$1}
Out=${Out=$needz/bin/$In}
#---------------------------------------------------------------
header() {   
cat<<EOF 
#!`which xgawk` -f            
# /* vim: set filetype=awk : */ -*- awk -*- 
#
# ----| $1 |--------------------------------------
#
#   _ _ _ _ _                          ((
#  |=|=|=|=|=|.------------------.    _))_
#  |-|-|-|-|-|| all your 'needz' | ___\__/)_
#  |_|_|_|_|_|'------------------. |_|_~~_|_|
#
# Built by "$USER" on `date`.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc.,51 Franklin Street, Fifth Floor, Boston, 
# MA 02110-1301, USA.
#
EOF
}

#---------------------------------------------------------------
my_m4() {
	m4 -P $needz/lib/includes.m4 $1; 
}
#---------------------------------------------------------------

[ -f $Out ] && rm -f $Out
( header $1; my_m4 $In ) > $Out
chmod +x $Out
chmod -w $Out
